<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template/template2.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListAccountTitle}"></h:outputText>
        </ui:define>
        <ui:define name="content">
            <div class="panel-wrapper fixed">
                <ul class="breadcrumbs-navigation">
                    <li><h:link outcome="List">Dashboard</h:link></li>
                    <li><h:link outcome="List">Account Management</h:link></li>
                </ul>
            </div>

            <div class="panel-wrapper fixed">
                <div class="content spacing">
                    <h:link outcome="Create" class="button-blue"><img alt="" src="#{facesContext.externalContext.request.contextPath}/resources/_layout/images/icons/icon-new.png" /> Add New</h:link>
                </div>
            </div> 
            <div class="panel-wrapper">
                <div class="panel">
                    <div class="title"> 
                        <h4>Table: <strong>Account Room</strong></h4>
                        <div class="collapse"></div>
                    </div>
                    <div class="content">

                        <h:form >
                            <h:panelGroup id="messagePanel" layout="block">
                                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                            </h:panelGroup>
                            
                                <p:dataTable value="#{accountController.items}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:1px solid #DDDDDD">
                                    <p:column>
                                        <f:facet name="header">
                                            <h:outputText value="#{bundle.ListAccountTitle_username}"/>
                                        </f:facet>
                                        <h:commandLink action="#{accountController.prepareView}">  <h:outputText value="#{item.username}"/></h:commandLink> 
                                    </p:column>
                                    <p:column>
                                        <f:facet name="header">
                                            <h:outputText value="#{bundle.ListAccountTitle_password}"/>
                                        </f:facet>
                                        <h:outputText value="#{item.password}"/>
                                    </p:column>
                                    <p:column>
                                        <f:facet name="header">
                                            <h:outputText value="Role"/>
                                        </f:facet>
                                        <h:outputText value="#{item.roleId.roleName}"/>
                                    </p:column>

                                    <p:column>
                                        <f:facet name="header">
                                            <h:outputText value="Fullname"/>
                                        </f:facet>
                                        <h:outputText value="#{item.userInformation.fullname}"/>
                                    </p:column>
                                    <p:column>
                                        <f:facet name="header">
                                            <h:outputText value="Address"/>
                                        </f:facet>
                                        <h:outputText value="#{item.userInformation.address}"/>
                                    </p:column>
                                    <p:column>
                                        <f:facet name="header">
                                            <h:outputText value="Email"/>
                                        </f:facet>
                                        <h:outputText value="#{item.userInformation.email}"/>
                                    </p:column>
                                    <p:column>
                                        <f:facet name="header">
                                            <h:outputText value="Phone"/>
                                        </f:facet>
                                        <h:outputText value="#{item.userInformation.phone}"/>
                                    </p:column>


                                    <p:column>
                                        <f:facet name="header">
                                            <h:outputText value="Actions"/>
                                        </f:facet>
                                      
                                            <h:commandLink action="#{accountController.prepareEdit}" class="icon"><img src="#{facesContext.externalContext.request.contextPath}/resources/_layout/images/icons/icon-edit.png" alt="Edit"/></h:commandLink>
                                            <h:commandLink action="#{accountController.destroy}" class="icon"><img src="#{facesContext.externalContext.request.contextPath}/resources/_layout/images/icons/icon-delete.png" alt="Delete"/></h:commandLink>                  
                                    </p:column>
                                </p:dataTable>
                            
                        </h:form>
                    </div>
                </div>
            </div>
        </ui:define>
    </ui:composition>

</html>
